require("UIView")
require("UIApplication")
require("TTVUserViewController")
require("NSDate")

//实例方法
defineClass("HomeViewController", {
            "tabLogoHeaderView_didClickSearch":function(instance,tabLogoview,obj) {
                //var aa = orgFunc(instance.__naturalOrgFunc); //调用原方法
                var vc = TTVUserViewController.alloc().init();
                vc.setHidesBottomBarWhenPushed(true);
                instance.navigationController().pushViewController_animated(vc,true)
                UIView.MakeToast_view_duration("我是UIApplications", UIApplication.sharedApplication().keyWindow(), 1);
                UIView.MakeToast_view_duration("我是HomeViewController", instance.view(), 1);
                instance.printJsFix()
            },
            "indexJsChange":function(instance,index) {
                return index;
            },
            }, {});

//类方法
defineClass("TTVBOTimeIntervalHandle", {},{
            "unixStampToTimeSinceNow":function(instance,unixStamp) {
                //var aa =  orgFunc(instance.__naturalOrgFunc); //调用原方法
                var unixTimeInterval = unixStamp/1000;
                var currentTimeInterval = NSDate.date().timeIntervalSince1970();
                var timeIntervalSinceNow = currentTimeInterval - unixTimeInterval;
                var date = NSDate.dateWithTimeIntervalSince1970(unixTimeInterval);
                if (timeIntervalSinceNow < 60 * 60){
                    var a = parseInt(timeIntervalSinceNow / (60) );
                    var text = String(a) + "分钟前";
                    return text;
                }
                else if (timeIntervalSinceNow < 60 * 60 * 24){
                    var a = parseInt(timeIntervalSinceNow / (60*60) );
                    var text = String(a) + "小时前";
                    return text;
                }
                else{
                    var day =  NSDate.getBeforDayCount(date);
                    var text = String(day) + "日前";
                    return text;
                }
                    return "";
            },
            "test":function(aa,bb,cc) {
                UIView.MakeToast_view_duration("我是UIApplications", UIApplication.sharedApplication().keyWindow(), 1);
                UIView.MakeToast_view_duration("我是HomeViewController", instance.view(), 1);
            },
});

//defineClass("TTVGlobalConfigManage", {
//            "ishiddenTimeLabel":function(instance) {
//                return 1;
//            },
//}, {});




